package com.stars.system.reim.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.stars.system.reim.service.IReimDailyRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 逾期记录 Controller
 *
 * @author shuaibizhe
 * @date 2023-01-25
 */
@RestController
@RequestMapping("/reim/daily/overdue")
public class ReimDailyOverdueController extends BaseController
{
    private static final int cycle = 40;

    @Autowired
    private IReimDailyRecordService dailyRecordService;

    /**
     * 查询逾期记录数量
     */
    @PreAuthorize("@ss.hasPermi('daily:record:list')")
    @GetMapping("/count")
    public String count()
    {
        return String.valueOf(dailyRecordService.countDailyOverdueRecords(cycle).size());
    }

    /**
     * 查询逾期记录
     */
    @PreAuthorize("@ss.hasPermi('daily:record:list')")
    @GetMapping("/list")
    public TableDataInfo list()
    {
        return getDataTable(dailyRecordService.countDailyOverdueRecords(cycle));
    }
}
